import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:mvvmdemo/view/page/loginpage.dart';
import 'package:mvvmdemo/view/page/salepage.dart';
import 'package:mvvmdemo/viewmodel/state/appmodel.dart';
import 'package:provider/provider.dart';

void main() => runApp(
  MultiProvider(
    providers: [
      ChangeNotifierProvider(create: (_) => AppModel()),
    ],
    child: const MyApp(),
  ),
);
class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return
        ScreenUtilInit(
          designSize: const Size(360, 640),
          builder: () =>
              MaterialApp(
                builder: BotToastInit(),
                debugShowCheckedModeBanner: false,
                routes: {'/loginpage': (_) => const LoginPage(), '/salepage': (_) => const SalePage()},
                title: 'Flutter MVVM',
                theme: ThemeData(
                  primarySwatch: Colors.blue,
                  textTheme: TextTheme(button: TextStyle(fontSize: 45.sp)),
                ),
                home: const LoginPage(),
                //home: HomePage(title: 'FlutterScreenUtil Demo'),
              ),
      );
  }
}
